package Code.Day5_20240922.com.dx.day05;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;

/**
 * @ClassName Pets
 * @Description 宠物-宠物类
 * @Author 12994
 * @Date 2024/9/22 15:57
 * @Version 1.0
 **/
@Getter
@Setter
@AllArgsConstructor
public class Pets implements Animal {
    /**
     * 宠物是动物的一个分支
     */
    protected String name;
    protected String colors;
    protected int age;

    @Override
    public String toString() {
        return "宠物姓名是: " + this.name + ", 颜色是: " + this.colors +
                ", 年龄是: " + this.age;
    }

    @Override
    public void run() {
        System.out.println("宠物" + this.name + "跑起来了!!");
    }

    @Override
    public String reName(String newName) {
        this.name = newName;
        return "这只宠物被起了一个新名字: " + this.name;
    }
}
